<template>
  <div>
    <div class="title"> {{"阶段配置 - ["+phaseData.name + "]"}}</div>
    <el-form :model="phaseData" label-width="70px" ref="ruleForm" size="mini" :rules="rules" :hide-required-asterisk="true">
      <el-row :gutter="24">
        <el-col :xs="23" :sm="12" :md="12" :lg="6" :xl="6">
          <el-form-item label="阶段名称">
            <el-input v-model="phaseData.name" disabled></el-input>
          </el-form-item>
        </el-col>
        <el-col :xs="23" :sm="12" :md="12" :lg="6" :xl="6">
          <el-form-item label="阶段类型">
            <el-input v-model="phaseData.phaseType" disabled></el-input>
          </el-form-item>
        </el-col>
        <el-col :xs="23" :sm="12" :md="12" :lg="6" :xl="6">
          <el-form-item label="阶段编码">
            <el-input v-model="phaseData.sn" disabled></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="24">
        <el-col :xs="23" :sm="24" :md="24" :lg="24" :xl="24">
          <el-form-item label="备注">
            <el-input type="textarea" rows="2" v-model="phaseData.description" placeholder="" clearable></el-input>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <div class="footerBtn">
      <el-button type="primary" size="small" :loading="loading"
        @click="handleConfirm('ruleForm')">{{ $t("common.preservation") }}</el-button>
      <!-- <el-button @click="handleClose()" size="small">{{ $t("common.cancel") }}</el-button> -->
    </div>

  </div>
</template>

<script>
import { configure } from "@/api/configure"
export default {
  props: {
    screenWidth: Number,
    isShow: Boolean,
    phaseData: Object,
    parentFid: String
  },
  data () {
    return {
      phaseId: "",
      loading: false,
      rules: {

      }
    }
  },
  watch: {
  },
  created () {

  },
  methods: {
    handleConfirm (formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          let param = {
            fid: this.phaseData.fid,
            name: this.phaseData.name,
            type: this.phaseData.type,
            sn: this.phaseData.sn,
            description: this.phaseData.description,
          }
          this.loading = true
          configure.phaseDefineAdd(param, '编辑').then(res => {
            this.loading = false
            if (res.code == 200) {
              this.$message({ duration: 1000, type: 'success', message: '保存成功!' });
              this.$emit('uptionList')
            }
          }).catch(e => {
            this.loading = false
          })
        }
      })
    },
  }
}
</script>

<style scoped>
.title {
  line-height: 35px;
  background: #3b2e58;
  color: #fff;
  padding: 0 15px;
  font-size: 14px;
  margin-bottom: 10px;
}
.footerBtn {
  text-align: right;
}
</style>